import 'package:flutter/material.dart';

class DnpAppBar extends StatelessWidget {
  final String title;
  final VoidCallback? onBackPressed;
  const DnpAppBar({super.key,required this.title, this.onBackPressed});

  @override
  Widget build(BuildContext context) {
    return _buildAppBar(context);
  }

  Widget _buildAppBar(BuildContext context) {
    return Padding(
      padding: EdgeInsets.only(
        top: MediaQuery.of(context).padding.top,
        left: 14,
        right: 14,
      ),
      child: Container(
        height: 44,
        child: Row(
          children: [
            GestureDetector(
              onTap: (){
                onBackPressed?.call();
                Navigator.pop(context);
              },
              child: Image.asset(
                "assets/images/ic_certification_back.png",
                width: 34,
                height: 34,
              ),
            ),
            const SizedBox(width: 10),
            const Spacer(),
            Text(
              title,
              style: const TextStyle(
                fontSize: 16,
                fontWeight: FontWeight.w600,
                color: Colors.white,
              ),
            ),
            const SizedBox(width: 34),
            const Spacer(),
          ],
        ),
      ),
    );
  }
}
